package com.groupYLP.CouponNexus.merchant.admin.common.enums;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
 * 优惠劵对象枚举
 */
@RequiredArgsConstructor
public enum DiscountTargetEnum {

    /**
     * 商品专属优惠
     */
    PRODUCT_SPECIFIC(0, "商品专属优惠"),

    /**
     * 全店通用优惠
     */
    ALL_STORE_GENERAL(1, "全店通用优惠");


    @Getter
    private final int type;

    @Getter
    private final String value;

    public static String findValueByType(int type) {
        for (DiscountTargetEnum item : values()) {
            if (item.getType() == type) {
                return item.getValue();
            }
        }
        throw new IllegalArgumentException();
    }

}
